<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>大奔农庄</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/aui.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/style.css"/>    
    <link rel="stylesheet" href="../../css/swiper.min.css">
    <link rel="stylesheet" href="../../font/iconfont.css">
</head>
<body>
	<!-- 内容开始 -->
	<div class="aui-content aui-margin-b-15">
		<div id="wudongtai_box" class="none">
			<img src="../../image/wudongtai.png" id="wudongtai_img" />
			<p id="wudongtai_txt"></p>
		</div>	
	    <ul class="aui-list aui-media-list" id="favourite">
		    <!--
		    <li class="aui-list-item gwc_tb2 db_cart_li_box"> 
			 	<div class="aui-media-list-item-inner">
			       	<div class="aui-list-item-media db_aui-list-item-media">
			           	<img src="http://daben.demo.dx623.com/Public/Uploads/Picture/2017-07-18/596dc6138dd1d.jpg">
			       	</div>
			        <div class="aui-list-item-inner db_cart_li_box_desc">
			        	<div class="aui-list-item-text">
			            	<div class="aui-list-item-title db_aui-list-item-title">{$vo.title}</div>
			            </div>
			            <div class="">
			            	<div class="db_car_li_box_desc_text">单价：￥{$vo.price}</div>
			            	<div class="db_car_li_box_desc_text" id="goods_xiaoji{$vo.gid}">小计：￥{$vo.xiaoji}</div>
						</div>
						<div class="tb1_td5 aui-pull-right db_aui-pull-right">
							<input id=jian{$vo.gid} type="button" value="-" class="cart_number_left" onclick="doCarJian({$vo.gid});"/>
							<input id="number{$vo.gid}" data-id="{$vo.gid}" class="cart_number_mid" data-price="{$vo.price}" type="text" readonly value="{$vo.goods_num}"  />
							<input id="jia{$vo.gid}" type="button" value="+" class="cart_number_right" onclick="doCarJia({$vo.gid});"/>
						</div>
			        </div>
				</div>
			    <div class="aui-clearfix"></div>
			</li>  
			-->
	   	</ul>
	</div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/aui-scroll.js"></script>
<script>
var useParam={},db_key = 'user',db_user;
	useParam.rtk = RSapi.myrtk;	
//页面初始化	
apiready = function() {	
	getuser();//获取用户数据
	useParam.rtk = RSapi.myrtk;		
	useParam.mytoken = db_user.mytoken;
	loaddata();//加载团购列表
}
//获取用户储存在本地的数据
function getuser() {
    db_user = $api.getStorage(db_key);
}
//加载内容
function loaddata() {
	api.ajax({
		url: RSapi.base+RSapi.favouriteList,
		method: 'post',
		cache: false,
		timeout: 30,
		dataType: 'json',
		data: { values: useParam },
	}, function(ret, err){
		if(err){
			//api.toast({msg: JSON.stringify(err)});
			api.toast({msg: err.msg});
		}else {
			if (ret.status==1) { 
				//成功了
				$api.html($api.byId('favourite'),ret.info);
				api.parseTapmode();
				eval('status_'+status+'=true;');
			}else if(ret.status==2){
				//没有内容
				$api.html($api.byId('favourite'),'');
				$api.removeCls($api.byId('wudongtai_box'), 'none');//显示无动态框
				$api.html($api.byId('wudongtai_txt'), ret.info);//显示提示内容
			}else {
				//失败了
				api.toast({msg: ret.info});
			}
		}
	});
}
//打开产品
function openGoodsinfo(id,title){
    api.openWin({
        name: 'win_goodsinfo',
        url: '../win/goodsinfo_win.html',
        pageParam: {gid: id,pagetitle:title}
    });
}  
//删除收藏
function delFav(id){
	useParam.id = id;

    api.ajax({
        url: RSapi.base+RSapi.favouriteDel,
        method: 'post',
        cache: false,
        timeout: 30,
        dataType: 'json',
        data: { values: useParam },
    }, function(ret, err){
        if(err){
            //alert(JSON.stringify(err));
            api.toast({msg: JSON.stringify(err)});
        }else {
            if (ret.status == 1) {
                //成功了
				api.toast({msg:ret.info});
				loaddata();
            }else {
                //失败了
                api.toast({msg: ret.info});
                loaddata();
            }
        }
    });
    return false;
}
</script>
</html>